package com.zhongkai.controller;

import com.zhongkai.app.service.IndentQueryService;
import com.zhongkai.model.utils.ZhongkaiResult;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.ResponseBody;

/**
 * 采购查询
 * */
@Controller
public class IndentQueryController {

    @Autowired
    private IndentQueryService indentQueryService;



    /**
     * 工程采购列表
     * @param page 页码
     * @param rows 条数
     */
    @RequestMapping(value = "/indent_query/list", produces = "application/json;charset=utf-8")
    @ResponseBody
    public ZhongkaiResult listIndentQuery(@RequestParam(defaultValue = "0") Integer page, @RequestParam(defaultValue = "0")Integer rows
    ) {


        ZhongkaiResult result = indentQueryService.listIndentQuery(page,rows);

        return result;
    }

    //----------------------办公采购查询---------------------------------------------

    /**
     * 办公采购列表
     */
    @RequestMapping(value = "/indent_query/list2", produces = "application/json;charset=utf-8")
    @ResponseBody
    public ZhongkaiResult listIndentQuery2(@RequestParam(defaultValue = "0") Integer page, @RequestParam(defaultValue = "0")Integer rows
    ) {


        ZhongkaiResult result = indentQueryService.listIndentQuery2(page,rows);

        return result;
    }




    /**
     * 柱状图 采购情况
     */
    @RequestMapping(value = "/indent_query/pillar", produces = "application/json;charset=utf-8")
    @ResponseBody
    public ZhongkaiResult listPillar(
    ) {


        ZhongkaiResult result = indentQueryService.listPillar();

        return result;
    }


    /**
     * 柱状图 办公采购情况
     */
    @RequestMapping(value = "/indent_query/pillar2", produces = "application/json;charset=utf-8")
    @ResponseBody
    public ZhongkaiResult listPillar2(
    ) {


        ZhongkaiResult result = indentQueryService.listPillar2();

        return result;
    }



    /**
     * 饼状图 工程采购情况
     */
    @RequestMapping(value = "/indent_query/piechart", produces = "application/json;charset=utf-8")
    @ResponseBody
    public ZhongkaiResult pieChart(
    ) {


        ZhongkaiResult result = indentQueryService.pieChart();

        return result;
    }



    /**
     * 饼状图 办公采购情况
     */
    @RequestMapping(value = "/indent_query/piechart2", produces = "application/json;charset=utf-8")
    @ResponseBody
    public ZhongkaiResult pieChart2(
    ) {


        ZhongkaiResult result = indentQueryService.pieChart2();

        return result;
    }

    /**
     * 查询接口
     *
     * @param page   页数
     * @param rows   每页数据数量
     * @param name   商品名称 非必传
     * @param status 类型 1工程 2办公
     * @param time   时间 非必传
     */
    @RequestMapping(value = "/indent_query/list_query", produces = "application/json;charset=utf-8")
    @ResponseBody
    public ZhongkaiResult listQuery(
            @RequestParam(defaultValue = "0") Integer page, @RequestParam(defaultValue = "0")Integer rows,
            String name, String status, @RequestParam(defaultValue = "0") Long time
    ) {


        ZhongkaiResult result = indentQueryService.listQuery(page,rows,name,status,time);

        return result;
    }
}
